home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / tex / dvivga9.zip / ACTFACT.H < prev    next >
Text File  |  1988-05-30  |  1KB  |  43 lines

  1. /* -*-C-*- actfact.h */
  2. /*-->actfact*/
  3. /**********************************************************************/
  4. /****************************** actfact *******************************/
  5. /**********************************************************************/
  6.  
  7. float
  8. actfact(unmodsize)
  9. register UNSIGN32 unmodsize;
  10.  
  11. /***********************************************************************
  12. Compute the actual size factor given the integer approximation unmodsize
  13. = (magnification  factor)*1000.   Values  not found  in  the  table  are
  14. rounded to the nearest table  entry; this ensures that rounding  errors,
  15. or  user  magnification  parameter  input  errors  result  in  something
  16. reasonable.  mag_table[] has a  wider range of magnifications  available
  17. than most sites will have, and can be used to find a nearest match  font
  18. when one is missing.
  19. ***********************************************************************/
  20.  
  21. {
  22.     register INT16 k;
  23.     register UNSIGN32 tab_entry;
  24.  
  25.     for (k = 1; k < MAGTABSIZE; ++k)
  26.     {
  27.     tab_entry = MAGSIZE(mag_table[k]);    /* round entry */
  28.     if (unmodsize < tab_entry) /* choose nearer of k-1,k entries */
  29.     {
  30.         if (unmodsize < MAGSIZE((mag_table[k-1] + mag_table[k])/2.0))
  31.             k--;            /* choose smaller one */
  32.         break;
  33.     }
  34.     else if (unmodsize == tab_entry)
  35.         break;
  36.     }
  37.     mag_index = ((k < MAGTABSIZE) ? k : (MAGTABSIZE-1));/* set global index */
  38.     return((float)mag_table[mag_index]);
  39. }
  40.  
  41.  
  42.  
  43.